package Algorithms.jishi.niuke.huawei;

import java.util.Scanner;

/**
 * description: <br>
 * createTime: 2020/11/189:47 <br>
 *
 * @author zzh
 */
public class CountIP {
    public static IP parse(String str) {
        String[] array = str.split("\\.");
        try {
            return new IP(parsetIPInt(array[0]), parsetIPInt(array[1]), parsetIPInt(array[2]), parsetIPInt(array[3]));
        } catch (Exception e) {
            return null;
        }
    }

    private static int parsetIPInt(String string) {
        int i = Integer.parseInt(string);
        if(i < 0 || i > 255) {
            throw new IllegalArgumentException("ip值非法");
        }
        return i;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int countA;
        int countB;
        int countC;
        int countD;
        int countE;
        int countError;
        int countprivate;
        while(scanner.hasNextLine()) {
            String input = scanner.nextLine();
            if("".equals(input)) {
                break;
            }
            String[] split = input.split("~");
            if(split.length < 2) {
                continue;
            }
            IP ip = parse(split[0]);
            IP ip4Mask = parse(split[1]);
            // 判断并计数
        }
    }
    public static class IP {
        private int i1;
        private int i2;
        private int i3;
        private int i4;


        public IP(int i1, int i2, int i3, int i4) {
            this.i1 = i1;
            this.i2 = i2;
            this.i3 = i3;
            this.i4 = i4;
        }


        public int getI1() {
            return i1;
        }


        public void setI1(int i1) {
            this.i1 = i1;
        }


        public int getI2() {
            return i2;
        }


        public void setI2(int i2) {
            this.i2 = i2;
        }


        public int getI3() {
            return i3;
        }


        public void setI3(int i3) {
            this.i3 = i3;
        }


        public int getI4() {
            return i4;
        }


        public void setI4(int i4) {
            this.i4 = i4;
        }
    }
}
